namespace WP7Contrib.Services.BingMaps.Model
{
    using System;
    using Common;

    public class RouteTransitLine : BaseModel, ICloneable<RouteTransitLine>
    {
        private string abbreviatedName;
        private string agencyId;
        private string agencyName;
        private string lineColor;
        private string lineTextColor;
        private string phoneNumber;
        private string providerInfo;
        private Uri uri;
        private string verboseName;

        public string AbbreviatedName
        {
            get
            {
                return this.abbreviatedName;
            }
            set
            {
                this.SetPropertyAndNotify(ref this.abbreviatedName, value, () => this.AbbreviatedName);
            }
        }

        public string AgencyId
        {
            get
            {
                return this.agencyId;
            }
            set
            {
                this.SetPropertyAndNotify(ref this.agencyId, value, () => this.AgencyId);
            }
        }

        public string AgencyName
        {
            get
            {
                return this.agencyName;
            }
            set
            {
                this.SetPropertyAndNotify(ref this.agencyName, value, () => this.AgencyName);
            }
        }

        public string LineColor
        {
            get
            {
                return this.lineColor;
            }
            set
            {
                this.SetPropertyAndNotify(ref this.lineColor, value, () => this.LineColor);
            }
        }

        public string LineTextColor
        {
            get
            {
                return this.lineTextColor;
            }
            set
            {
                this.SetPropertyAndNotify(ref this.lineTextColor, value, () => this.LineTextColor);
            }
        }

        public string PhoneNumber
        {
            get
            {
                return this.phoneNumber;
            }
            set
            {
                this.SetPropertyAndNotify(ref this.phoneNumber, value, () => this.PhoneNumber);
            }
        }

        public string ProviderInfo
        {
            get
            {
                return this.providerInfo;
            }
            set
            {
                this.SetPropertyAndNotify(ref this.providerInfo, value, () => this.ProviderInfo);
            }
        }

        public Uri Uri
        {
            get
            {
                return this.uri;
            }
            set
            {
                this.SetPropertyAndNotify(ref this.uri, value, () => this.Uri);
            }
        }

        public string VerboseName
        {
            get
            {
                return this.verboseName;
            }
            set
            {
                this.SetPropertyAndNotify(ref this.verboseName, value, () => this.VerboseName);
            }
        }

        public bool HasUri
        {
            get { return this.uri != null; }
        }

        public RouteTransitLine ShallowClone()
        {
            var line = new RouteTransitLine
            {
                AbbreviatedName = this.abbreviatedName,
                AgencyId = this.agencyId,
                AgencyName = this.agencyName,
                LineColor = this.lineColor,
                LineTextColor = this.lineTextColor,
                PhoneNumber = this.phoneNumber,
                ProviderInfo = this.providerInfo,
                Uri = this.uri,
                VerboseName = this.verboseName
            };

            return line;
        }

        public RouteTransitLine DeepClone()
        {
            var line = new RouteTransitLine
            {
                AbbreviatedName = this.abbreviatedName,
                AgencyId = this.agencyId,
                AgencyName = this.agencyName,
                LineColor = this.lineColor,
                LineTextColor = this.lineTextColor,
                PhoneNumber = this.phoneNumber,
                ProviderInfo = this.providerInfo,
                VerboseName = this.verboseName
            };

            if (this.HasUri)
                Uri = new Uri(this.uri.ToString());

            return line;
        }
    }
}